package info.nixbear.tgcms.domain;

import javax.jdo.annotations.Discriminator;
import javax.jdo.annotations.DiscriminatorStrategy;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.Version;
import javax.jdo.annotations.VersionStrategy;

import com.google.appengine.api.datastore.Text;

@PersistenceCapable(identityType=IdentityType.APPLICATION, detachable="true")
@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME)
@Version( 
		strategy=VersionStrategy.VERSION_NUMBER, 
		column = "version", 
		extensions={@Extension(vendorName="datanucleus", key="field-name", 
		value="version")}) 
public class Redirect extends EntityBase {

    @Persistent
    private String name;

    @Persistent
    private String fromUrl;

    @Persistent
    private String toUrl;
    
    @Persistent
    private Text comment;
    

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}


	public String getFromUrl() {
		return fromUrl;
	}

	public void setFromUrl(String fromUrl) {
		this.fromUrl = fromUrl;
	}

	public String getToUrl() {
		return toUrl;
	}

	public void setToUrl(String toUrl) {
		this.toUrl = toUrl;
	}

	public Text getComment() {
		return comment;
	}

	public void setComment(Text comment) {
		this.comment = comment;
	}

	
	public String getCommentAsString() {
		return (this.getComment() == null)?null:this.getComment().getValue();
	}
	
	public void setCommentAsString(String htmlString) {
		this.setComment(new Text(htmlString));
	}
	
}
